<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="demo">
        <p>firstName: <input type="text" name="" v-model="firstName"></p>
        <p>lastName: <input type="text" name="" v-model="lastName"></p>
        <p>fullName: {{getFullName()}}</p>
        <p>fullName: {{getFullName()}}</p>
        <p>fullName: {{getFullName()}}</p>
        <p>fullName: {{getFullName()}}</p>
        <p>fullName: {{getFullName()}}</p>
        <p>fullName: {{getFullName()}}</p>
    </div>
    <script>
        Vue.config.productionTip = false
        new Vue({
            el: '#demo',
            data: {
                firstName: 'zhang',
                lastName: 'san'
            },
            methods:{
                getFullName(){
                    console.log('函数 run')
                    return this.firstName[0].toUpperCase() + this.firstName.slice(1)+ '-' + this.lastName
                }
            }
        })
    </script>
</body>

</html>